﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace QueryGenerator
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void label4_Click(object sender, EventArgs e)
        {

        }

        private void label5_Click(object sender, EventArgs e)
        {

        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void txtSubmit_Click(object sender, EventArgs e)
        {


                
        }

        private string BuildRequest()
        {
            string tqxformat = "tqx=version:{0};reqId:{1};sig:{2};out:{3}; responseHandler:{4}";

            string tqformat = "tq={0}";

            string request = "";
            string query = "";
            string exquery = "";

            if (txtQuery.Text.Length > 0)
            {
                query = String.Format(tqformat, txtQuery.Text);
            }

            exquery = String.Format(tqxformat, txtVersion.Text,
                                                                        txtReqID.Text,
                                                                        txtSig.Text,
                                                                        comboOut.SelectedText.ToLower(),
                                                                        txtResponseHandler.Text);

            request = String.Format("{0}?{1}", query, exquery);

            return request;
        }

        private void butViewRequest_Click(object sender, EventArgs e)
        {
            txtRequest.Text = BuildRequest();
        }
    }
}
